# Contributor: Luca Weiss <luca@z3ntu.xyz>
# Maintainer: Luca Weiss <luca@z3ntu.xyz>
pkgname=ayatana-indicator-session
pkgver=24.2.0
pkgrel=0
pkgdesc="Ayatana Indicator Session Applet"
url="https://github.com/AyatanaIndicators/ayatana-indicator-session"
arch="all"
license="GPL-3.0-only"
makedepends="
	cmake
	cmake-extras
	glib-dev
	gtest-dev
	intltool
	libayatana-common-dev
	librda-dev
	samurai
	"
checkdepends="dbus"
subpackages="$pkgname-lang"
source="https://github.com/AyatanaIndicators/ayatana-indicator-session/archive/$pkgver/ayatana-indicator-session-$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DENABLE_TESTS=ON \
		$CMAKE_CROSSOPTS .
	cmake --build build
}

check() {
	cd build
	# https://github.com/AyatanaIndicators/ayatana-indicator-session/issues/90
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest -E test-service
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
4d2590fa2bb534adba7fbdba49451bec2b63c51a30fec9722ca07af298d35bacaa41fbdba2e3a255a995190e501dbd7d8da40c4bb0343c0c5006c5bbcd500ac8  ayatana-indicator-session-24.2.0.tar.gz
"
